<template>
    <div class="groupArea">
        <div class="top">
            <h1>拼团专区</h1>
            <span>拼着买跟实惠</span>
            <i class="iconfont">&#xe634;</i>
        </div>
        <div class="groupArea-container swiper-container">
            <div class="swiper-wrapper">
                <div class="swiper-slide" v-for="item in data" :key="item.id">
                    <img :src="item.goods_thumb" alt="">
                    <span class="title">{{ item.goods_name }}</span>
                    <span class="newPrice">
                        <img src=""
                            alt="">
                        {{ item.team_price_formated }}</span>
                    <span class="oldPrice">{{ item.shop_price_formated }}</span>
                </div>
            </div>
        </div>
    </div>
</template>

<script>

import Swiper from 'swiper'

export default {
    props: ["data"],
    data() {
        return {
            swiper: null,
        }
    },
    mounted() {
        new Swiper('.groupArea-container', {
            slidesPerView: 'auto',
            spaceBetween: 10,
            freeMode: true,
            freeModeSticky: true,
        })
    },

}
</script>

<style scoped>
.groupArea {
    width: 94.6667vw;
    background-color: #fff;
    margin: 2.6667vw auto;
    padding: 0 2.6667vw;
    box-sizing: border-box;
    border-radius: 2.6667vw;
    overflow: hidden;
}

.top {
    display: flex;
    width: 100%;
    height: 13.3333vw;
    line-height: 13.3333vw;
    gap: 2.6667vw;
    box-sizing: border-box;
    border-bottom: 1px solid #f0f0f0;
    h1{
        font-size: 5.3333vw;
        font-weight: bold;
    }
    span{
        font-size: 3.7333vw;
        color: #aaa;
    }
    i.iconfont{
        color: red;
        font-size: 5.3333vw;
    }
}


.groupArea-container {
    display: flex;
    width: 100%;
    flex-direction: column;
    padding-bottom: 2.6667vw;
}

.groupArea-container .swiper-slide {
    width: 28vw;
}

.groupArea-container img {
    width: 28vw;
    height: 26.6667vw;
}

.groupArea-container span {
    font-size: 3.2vw;
    display: block;
}

.groupArea-container .title {
    width: 26.6667vw;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    overflow: hidden;
    line-height: 6.4vw;
    font-size: 3.7333vw;
}

.groupArea-container .newPrice {
    color: red;
    font-weight: bold;
    font-size: 3.7333vw;
    line-height: 8vw;
    img{
        width: 4.8vw;
        height: 4.8vw;
        vertical-align:text-bottom;
    }
}

.groupArea-container .oldPrice {
    text-decoration: line-through;
    color: #999;
}
</style>